package org.wkg.lesson04.lesson10;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

public class Demo_1002 {

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger();
        System.out.println(atomicInteger.get());//初始化默认为0

        atomicInteger.getAndIncrement();//i++
        System.out.println(atomicInteger.get());

        System.out.println(atomicInteger.incrementAndGet());//++i

        atomicInteger.getAndDecrement();//i--
        System.out.println(atomicInteger.get());

        System.out.println(atomicInteger.decrementAndGet());//--i

        atomicInteger.getAndAdd(100);//i+=100
        System.out.println(atomicInteger);

        System.out.println("===========================================");
        System.out.println("===========================================");
        System.out.println("===========================================");
        System.out.println("===========================================");

        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
        System.out.println(UUID.randomUUID());
    }
}
